package com.ilearn.limiter.utils;


import com.ilearn.limiter.enums.ResponseEnum;

/**
 *
 *@project chinabond-edb
 *@description 结果集工具类
 *
 *@errorcode
 *          SystemException</br>
 *
 *@author
 *       2018-06-08 11:07 qichao Create 1.0 <br>
 *
 *@copyright ©2017-2017 中央结算公司，版权所有。
 */
public class ResultUtil {

    public static Result success(Object obj) {
        Result result = new Result();
        result.setCode(ResponseEnum.OK.getCode());
        result.setMsg(ResponseEnum.OK.getMsg());
        result.setData(obj);
        return result;
    }

    public static Result error(ResponseEnum resultEnum) {
        return error(resultEnum, resultEnum.getMsg());
    }

    public static Result error(ResponseEnum resultEnum, String msg) {
        Result result = new Result();
        result.setCode(resultEnum.getCode());
        result.setMsg(msg);
        return result;
    }


}
